//
//  SISSNetworkingManager+PassengerProgress.m
//  SISSAPP
//
//  Created by 优房网 on 2017/8/24.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSNetworkingManager+PassengerProgress.h"
#import "SISSHouseResourceModel.h"
#import "SISSPassengerProgressRecordInfoModel.h"
#import "SISSBuyerInfoModel.h"
#import "SISSBrokerInfoModel.h"
#import "SISSPassengerCooperationDetailModel.h"
#import "SISSBuyerEntrustContractModel.h"
#import "SISSPassengerTakeLookModel.h"
#import "SISSPassengerTakeLookDetailModel.h"
#import "SISSBuyerEntrustContractDraftModel.h"
#import "SISSCommentModel.h"
#import "SISSNetworkingManager+File.h"
#import "SISSBuyHouseQualificationModel.h"

@implementation SISSNetworkingManager (PassengerProgress)

// 4.2.2 删除客源进度 GET请求
- (void)deletePassengerProgressWithHouseAdbpId:(NSString *)adbpId successBlock:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    NSDictionary *parameters = @{
                                 @"adbpId":adbpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_DELETE_PASSENGER_PROGRESS parameters:parameters success:^(id responseObject) {
        NSLog(@"4.2.2 删除客源进度 GET请求: responseObject-->%@",responseObject);
        
        if (successBlock) {
            successBlock(responseObject);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

//  4.4.2 获取客源进度时间和id信息 GET请求
- (void)requestPassengerProgressRecordInfoWithAdbpId:(NSString *)adbpId success:(void (^)(SISSPassengerProgressRecordInfoModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"adbpId":adbpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_PASSENGER_PROGRESS_INFO parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.4.2 获取客源进度时间和id信息 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSDictionary *dataDict = responseObject[@"data"];
        
        SISSPassengerProgressRecordInfoModel *model = [SISSPassengerProgressRecordInfoModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(model);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.23.2  获取客源推荐的房源信息 GET请求
- (void)requestPassengerRecommendHouseWithAdbpId:(NSString *)adbpId success:(void (^)(NSArray<SISSHouseResourceModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"spId":[SISSUserAccount shared].spId ,
                                 @"adbpId":adbpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_DEMAND_RECOMMEND_HOUSE parameters:parameters success:^(id responseObject) {
        NSLog(@"4.23.2  获取客源推荐的房源信息: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *houseResourceArr = [NSArray yy_modelArrayWithClass:[SISSHouseResourceModel class] json:dataArr];
        if (successBlock) {
            successBlock(houseResourceArr);
        }
  
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.25.2.1 获取客源带看记录 GET请求
- (void)requestPassengerTakelookRecordWithAdbpId:(NSString *)adbpId success:(void (^)(NSArray<SISSPassengerTakeLookModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"adbpId":adbpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_PASSENGER_TAKELOOK_RECORD parameters:parameters success:^(id responseObject) {
        NSLog(@"4.25.2.1 获取客源带看记录 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *takelookArr = [NSArray yy_modelArrayWithClass:[SISSPassengerTakeLookModel class] json:dataArr];
        if (successBlock) {
            successBlock(takelookArr);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.25.2.2 获取客源带看记录详情 GET请求
- (void)requestPassengerTakelookDetailWithId:(NSString *)ID type:(NSInteger)type success:(void (^)(SISSPassengerTakeLookDetailModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"id":ID,
                                 @"type":@(type)
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_PASSENGER_TAKELOOK_DETAIL parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.25.2.2 获取客源带看记录详情 GET请求: responseObject-->%@",responseObject);
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        NSDictionary *dataDict = responseObject[@"data"];
        SISSPassengerTakeLookDetailModel *takeLookDetail = [SISSPassengerTakeLookDetailModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(takeLookDetail);
        }
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.25.2.3.1  获取带看经纪人评价买家 GET请求
- (void)requestCommentTakeLookBrokerCommentBuyerInfoWithAtlrId:(NSString *)atlrId takelookType:(NSInteger)takelookType success:(void (^)(NSArray<SISSCommentModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
   
    NSDictionary *parameters = @{
                                 @"spId":[SISSUserAccount shared].spId,
                                 @"atlrId":atlrId,
                                 @"takelook_type":@(takelookType)
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_TAKELOOK_BROKER_COMMENT_BUYER parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.25.2.3.1  获取带看经纪人评价买家 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSCommentModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.25.2.3.2  获取带看买家评价经纪 GET请求
- (void)requestCommentTakeLookBuyerCommentBrokerInfoWithAtlrId:(NSString *)atlrId success:(void (^)(NSArray<SISSCommentModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"spId":[SISSUserAccount shared].spId,
                                 @"atlrId":atlrId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_TAKELOOK_BUYER_COMMENT_BROKER parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.25.2.3.2  获取带看买家评价经纪 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSCommentModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.25.2.4  经纪人评价买家
- (void)insertBrokerCommentBuyerWithParameters:(NSDictionary *)parameters success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameter = @{
                                @"spId":[SISSUserAccount shared].spId,
                                };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
    [params addEntriesFromDictionary:parameters];
    
    [kNetworkManager POSTWithURLString:URL_PROGRESS_INSERT_BROKER_COMMENT_BUYER parameters:params success:^(id responseObject) {
        NSLog(@"4.25.2.4 经纪人评价买家: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        if (successBlock) {
            successBlock(responseObject);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];

}

// 4.25.2.5  删除客源进度带看记录 GET请求
- (void)deletePassengerTakelookWithId:(NSString *)ID type:(NSInteger)type success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"id":ID,
                                 @"type":@(type)
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_DELETE_PASSENGER_TAKELOOK parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.25.2.5  删除客源进度带看记录 GET请求: responseObject-->%@",responseObject);
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        if (successBlock && [responseObject[@"code"] integerValue] == 200) {
            successBlock(responseObject);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.26.2 获取客源进度委托合同 GET请求
- (void)requestPassengerProgressEntrustContractWithAdbpId:(NSString *)adbpId success:(void (^)(SISSEntrustContractModel *))successBlock failed:(void (^)(NSError *))failedBlock {
//    NSDictionary *parameters = @{
//                                 @"abpId":adbpId
//                                 };
    
//    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_PASSENGER_ENTRUST_CONTRACT parameters:parameters success:^(id responseObject) {
//        NSLog(@"4.26.2 获取客源进度委托合同 GET请求: responseObject-->%@",responseObject);
//        
//        if ([responseObject[@"code"] integerValue] != 200) {
//            
//            NSLog(@"%@",responseObject[@"data"]);
//        }
//        
//        NSDictionary *dataDict = responseObject[@"data"];
//        SISSEntrustContractModel *buyerEntrustModel = [SISSEntrustContractModel yy_modelWithJSON:dataDict];
//        if (successBlock) {
//            successBlock(buyerEntrustModel);
//        }
//        
//    } failure:^(NSError *error) {
//        
//        if (failedBlock) {
//            failedBlock(error);
//        }
//    }];
}

// 4.26.2.1 上传购房资格 (图文上传)
- (void)insertBuyHouseQualificationWithParameters:(NSDictionary *)parameters images:(NSArray<UIImage *> *)images success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager uploadFileListWatermark:images success:^(id  _Nonnull responseObject) {
        NSLog(@"%@",responseObject);
        if ([responseObject[@"code"] integerValue] == 200) {
            NSArray *dataArr = responseObject[@"data"];
            NSDictionary *parameter = @{
                                        @"saId":[SISSUserAccount shared].saId,
                                        @"file":dataArr,
                                        };
            NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
            [params addEntriesFromDictionary:parameters];
            [kNetworkNoUTF8Manager POSTWithURLString:URL_PROGRESS_INSERT_BUY_HOUSE_QUALIFICATION parameters:params success:^(id responseObject) {
                NSLog(@"4.26.2.1 上传购房资格 (图文上传): responseObject-->%@",responseObject);
                
                if (successBlock) {
                    successBlock(responseObject);
                }
            } failure:^(NSError *error) {
                if (failedBlock) {
                    failedBlock(error);
                }
            }];
        }
    } failed:^(NSError * _Nonnull error) {
        NSLog(@"%@",error);
    }];
}


// 4.26.2.3 获取购房资格 GET请求
- (void)requestBuyHouseQualificationInfoWithAdbpId:(NSString *)adbpId success:(void (^)(SISSBuyHouseQualificationModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    NSDictionary *parameters = @{
                                 @"adbpId":adbpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_BUY_HOUSE_QUALIFICATION parameters:parameters success:^(id responseObject) {
        NSLog(@"4.26.2.3 获取购房资格 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSDictionary *dataDict = responseObject[@"data"];
        SISSBuyHouseQualificationModel *qualificationModel = [SISSBuyHouseQualificationModel yy_modelWithJSON:dataDict];
        
        if (successBlock) {
            successBlock(qualificationModel);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.26.2.4 更新购房资格证明 (图文上传) PUT请求
- (void)updateBuyHouseQualificationWithParameters:(NSDictionary *)parameters images:(NSArray<UIImage *> *)images success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    [SISSPublicSingleton shared].isHud = NO;
    if (images.count > 0) {
        [kNetworkManager uploadFileListWatermark:images success:^(id  _Nonnull responseObject) {
            NSLog(@"%@",responseObject);
            if ([responseObject[@"code"] integerValue] == 200) {
                NSArray *dataArr = responseObject[@"data"];
                NSDictionary *parameter = @{
                                            @"saId":[SISSUserAccount shared].saId,
                                            @"file":dataArr,
                                            };
                NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
                [params addEntriesFromDictionary:parameters];
                [kNetworkNoUTF8Manager PUTWithURLString:URL_PROGRESS_UPDATE_BUY_HOUSE_QUALIFICATION parameters:params success:^(id responseObject) {
                    NSLog(@"4.26.2.4 更新购房资格证明 (图文上传) PUT请求: responseObject-->%@",responseObject);
                    
                    if (successBlock) {
                        successBlock(responseObject);
                    }
                } failure:^(NSError *error) {
                    if (failedBlock) {
                        failedBlock(error);
                    }
                }];
            }
        } failed:^(NSError * _Nonnull error) {
            NSLog(@"%@",error);
        }];
    } else {
        NSDictionary *parameter = @{
                                    @"saId":[SISSUserAccount shared].saId,
                                    };
        NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
        [params addEntriesFromDictionary:parameters];
        [kNetworkNoUTF8Manager PUTWithURLString:URL_PROGRESS_UPDATE_BUY_HOUSE_QUALIFICATION parameters:params success:^(id responseObject) {
            NSLog(@"4.26.2.4 更新购房资格证明 (图文上传) PUT请求: responseObject-->%@",responseObject);
            
            if (successBlock) {
                successBlock(responseObject);
            }
        } failure:^(NSError *error) {
            if (failedBlock) {
                failedBlock(error);
            }
        }];
    }
}

// 4.32.2.1 获取经纪人评价买家的记录 GET请求
- (void)requestCommentBrokerCommentBuyerInfoWithAdbpId:(NSString *)adbpId success:(void (^)(NSArray<SISSCommentModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"spId":[SISSUserAccount shared].spId,
                                 @"adbpId":adbpId,
                                 @"comment_type":@(2),
                                 @"atlrId":@"-1",
                                 @"takelook_type":@(-1)
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_BROKER_COMMENT_BUYER parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.32.2.1 获取经纪人评价买家的记录 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSCommentModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.32.2.2 获取买家评价经纪人的记录 GET请求
- (void)requestCommentBuyerCommentBrokerInfoWithAdbpId:(NSString *)adbpId success:(void (^)(NSArray<SISSCommentModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"spId":[SISSUserAccount shared].spId,
                                 @"adbpId":adbpId,
                                 @"comment_type":@(2),
                                 @"atlrId":@"-1",
                                 @"takelook_type":@(-1)
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_BUYER_COMMENT_BROKER parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.32.2.2 获取买家评价经纪人的记录 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSCommentModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.37.1 更新客源进度委托合同状态 GET请求 state：2不同意
- (void)disagreeBuyerCommissionContractWithId:(NSString *)ID success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    NSDictionary *parameters = @{
                                 @"id":ID,
                                 @"state":@2 // 不同意
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_UPDATE_BUYER_COMMISSON_CONTRACT parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.37.1 更新客源进度委托合同状态 GET请求: responseObject-->%@",responseObject);
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        if (successBlock && [responseObject[@"code"] integerValue] == 200) {
            successBlock(responseObject);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.38.2 获取告知书买家信息(线下)
- (void)requestImportNotiOfflineBuyerInfoWithID:(NSString *)ID success:(void (^)(SISSBuyerInfoModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"id":ID
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_BUYER_IMOPRTANT_NOTI_OFFLINE_BUYER_INFO parameters:parameters success:^(id responseObject) {
        NSLog(@"4.38.2 获取告知书买家信息(线下) GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSDictionary *dataDict = responseObject[@"data"];
        SISSBuyerInfoModel *buyerInfo = [SISSBuyerInfoModel yy_modelWithJSON:dataDict];
        
        if (successBlock) {
            successBlock(buyerInfo);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.25.2 添加客源带看记录  (图文上传)
- (void)insertPassengerProgressTakeLookWithParameters:(NSDictionary *)parameters images:(NSArray<UIImage *> *)images success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager uploadFileListWatermark:images success:^(id  _Nonnull responseObject) {
        NSLog(@"%@",responseObject);
        if ([responseObject[@"code"] integerValue] == 200) {
            NSArray *dataArr = responseObject[@"data"];
            NSDictionary *parameter = @{
                                        @"file":dataArr,
                                        };
            NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
            [params addEntriesFromDictionary:parameters];
            
            [kNetworkNoUTF8Manager POSTWithURLString:URL_PROGRESS_INSERT_PASSENGER_TAKELOOK parameters:params success:^(id responseObject) {
                NSLog(@"4.25.2 添加客源带看记录 (图文上传): responseObject-->%@",responseObject);
                
                if (successBlock) {
                    successBlock(responseObject);
                }
            } failure:^(NSError *error) {
                if (failedBlock) {
                    failedBlock(error);
                }
            }];
        }
    } failed:^(NSError * _Nonnull error) {
        NSLog(@"%@",error);
    }];
}

// 4.29.2 添加客源进度委托合同 (图文上传)
- (void)insertPassengerEntrustContractWithParameters:(NSDictionary *)parameters images:(NSArray<UIImage *> *)images success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager uploadFileListWatermark:images success:^(id  _Nonnull responseObject) {
        NSLog(@"%@",responseObject);
        if ([responseObject[@"code"] integerValue] == 200) {
            NSArray *dataArr = responseObject[@"data"];
            NSDictionary *parameter = @{
                                        @"saId":[SISSUserAccount shared].saId,
                                        @"file":dataArr,
                                        };
            NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
            [params addEntriesFromDictionary:parameters];
            [kNetworkNoUTF8Manager POSTWithURLString:URL_PROGRESS_INSERT_PASSENGER_ENTRUST_CONTRACT parameters:params success:^(id responseObject) {
                NSLog(@"4.29.2 添加客源进度委托合同 (图文上传): responseObject-->%@",responseObject);
                
                if (successBlock) {
                    successBlock(responseObject);
                }
            } failure:^(NSError *error) {
                if (failedBlock) {
                    failedBlock(error);
                }
            }];
        }
    } failed:^(NSError * _Nonnull error) {
        NSLog(@"%@",error);
    }];
}

// 4.37.2 同意买家委托合同 (图文上传)
- (void)insertAgreeBuyerCommissionContractWithId:(NSString *)ID images:(NSArray<UIImage *> *)images success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager uploadFileListWatermark:images success:^(id  _Nonnull responseObject) {
        NSLog(@"%@",responseObject);
        if ([responseObject[@"code"] integerValue] == 200) {
            NSArray *dataArr = responseObject[@"data"];
            NSDictionary *parameters = @{
                                         @"spId":[SISSUserAccount shared].spId,
                                         @"saId":[SISSUserAccount shared].saId,
                                         @"soId":[SISSUserAccount shared].soId,
                                         @"file":dataArr.firstObject,
                                         @"id":ID
                                         };
            [kNetworkNoUTF8Manager POSTWithURLString:URL_PROGRESS_AGREE_BUYER_COMMISSON_CONTRACT parameters:parameters success:^(id responseObject) {
                NSLog(@"4.37.2 同意买家委托合同 (图文上传): responseObject-->%@",responseObject);
                
                if (successBlock) {
                    successBlock(responseObject);
                }
            } failure:^(NSError *error) {
                if (failedBlock) {
                    failedBlock(error);
                }
            }];
        }
    } failed:^(NSError * _Nonnull error) {
        NSLog(@"%@",error);
    }];
}

// 4.2.33.1 插入按揭预约登记信息 (图文上传)
- (void)insertMortgageAppointmentInfoWithParamters:(NSDictionary *)parameters images:(NSArray<UIImage *> *)images success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager uploadFileListWatermark:images success:^(id  _Nonnull responseObject) {
        NSLog(@"%@",responseObject);
        if ([responseObject[@"code"] integerValue] == 200) {
            NSArray *dataArr = responseObject[@"data"];
            NSDictionary *parameter = @{
                                        @"file":dataArr
                                        };
            NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
            [params addEntriesFromDictionary:parameters];
            
            [kNetworkNoUTF8Manager POSTWithURLString:URL_PROGRESS_INSERT_MORTGATE_APPOINTMENT_INFO parameters:params success:^(id responseObject) {
                NSLog(@"4.2.33.1 插入按揭预约登记信息 (图文上传) (图文上传): responseObject-->%@",responseObject);
                
                if (successBlock) {
                    successBlock(responseObject);
                }
            } failure:^(NSError *error) {
                if (failedBlock) {
                    failedBlock(error);
                }
            }];
        }
    } failed:^(NSError * _Nonnull error) {
        NSLog(@"%@",error);
    }];
}

// 4.2.33.2 获取按揭预约登记信息 GET请求
- (void)requestMortgageAppointmentInfoWithAdbpId:(NSString *)adbpId success:(void (^)(SISSMortgageAppointmentInfoModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    NSDictionary *parameters = @{@"adbpId": adbpId};
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_MORTGATE_APPOINTMENT_INFO parameters:parameters success:^(id responseObject) {
        NSLog(@"4.2.33.2 获取按揭预约登记信息 GET请求: responseObject-->%@",responseObject);
        if ([responseObject[@"code"] integerValue] == 200) {
            SISSMortgageAppointmentInfoModel *model = [SISSMortgageAppointmentInfoModel yy_modelWithJSON:responseObject[@"data"]];
            if (successBlock) {
                successBlock(model);
            }
        }
    } failure:^(NSError *error) {
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}
// 4.2.33.3 修改按揭预约登记信息 (图文上传)
- (void)updateMortgageAppointmentInfoWithParamters:(NSDictionary *)parameters images:(NSArray<UIImage *> *)images success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    if (images.count > 0) {
        [SISSPublicSingleton shared].isHud = NO;
        [kNetworkManager uploadFileListWatermark:images success:^(id  _Nonnull responseObject) {
            NSLog(@"%@",responseObject);
            if ([responseObject[@"code"] integerValue] == 200) {
                NSArray *dataArr = responseObject[@"data"];
                NSDictionary *parameter = @{
                                            @"file":dataArr
                                            };
                NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
                [params addEntriesFromDictionary:parameters];
                [SISSPublicSingleton shared].isHud = NO;
                [kNetworkNoUTF8Manager PUTWithURLString:URL_PROGRESS_PUT_MORTGATE_APPOINTMENT_INFO parameters:params success:^(id responseObject) {
                    NSLog(@"4.2.33.3 修改按揭预约登记信息 (图文上传) PUT请求: responseObject-->%@",responseObject);
                    
                    if (successBlock) {
                        successBlock(responseObject);
                    }
                } failure:^(NSError *error) {
                    if (failedBlock) {
                        failedBlock(error);
                    }
                }];
            }
        } failed:^(NSError * _Nonnull error) {
            NSLog(@"%@",error);
        }];
    } else {
        [SISSPublicSingleton shared].isHud = NO;
        [kNetworkNoUTF8Manager PUTWithURLString:URL_PROGRESS_PUT_MORTGATE_APPOINTMENT_INFO parameters:parameters success:^(id responseObject) {
            NSLog(@"4.2.33.3 修改按揭预约登记信息 PUT请求: responseObject-->%@",responseObject);
            
            if (successBlock) {
                successBlock(responseObject);
            }
        } failure:^(NSError *error) {
            if (failedBlock) {
                failedBlock(error);
            }
        }];
    }
}

// 4.2.34.1 插入产权登记中心办理抵押
- (void)insertPropertyMortgageInfoWithParamters:(NSDictionary *)parameters success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager POSTWithURLString:URL_PROGRESS_INSERT_PROPERTY_MORTGATE_INFO parameters:parameters success:^(id responseObject) {
        NSLog(@"4.2.34.1 插入产权登记中心办理抵押: responseObject-->%@",responseObject);
        
        if (successBlock) {
            successBlock(responseObject);
        }
    } failure:^(NSError *error) {
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.2.34.2 获取产权登记中心办理抵押 GET请求
- (void)requestPropertyMortgageInfoWithAdbpId:(NSString *)adbpId success:(void (^)(SISSPropertyMortgageInfoModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    NSDictionary *parameters = @{@"adbpId": adbpId};
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_PROPERTY_MORTGATE_INFO parameters:parameters success:^(id responseObject) {
        NSLog(@"4.2.34.2 获取产权登记中心办理抵押 GET请求: responseObject-->%@",responseObject);
        if ([responseObject[@"code"] integerValue] == 200) {
            SISSPropertyMortgageInfoModel *model = [SISSPropertyMortgageInfoModel yy_modelWithJSON:responseObject[@"data"]];
            if (successBlock) {
                successBlock(model);
            }
        }
    } failure:^(NSError *error) {
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.2.34.3 修改产权登记中心办理抵押 PUT请求
- (void)updatePropertyMortgageInfoWithParamters:(NSDictionary *)parameters success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager POSTWithURLString:URL_PROGRESS_PUT_PROPERTY_MORTGATE_INFO parameters:parameters success:^(id responseObject) {
        NSLog(@"4.2.34.3 修改产权登记中心办理抵押 PUT请求: responseObject-->%@",responseObject);
        
        if (successBlock) {
            successBlock(responseObject);
        }
    } failure:^(NSError *error) {
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.2.35.1 获取客源进度客户信息 GET请求
- (void)requestrProgressBuyerInfoWithAdbpId:(NSString *)adbpId demandType:(NSInteger)demandType success:(void (^)(SISSBuyerInfoModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    NSDictionary *parameters = @{
                                 @"adbpId":adbpId,
                                 @"demand_type":@(demandType)
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_BUYER_INFO_BY_ADBPID parameters:parameters success:^(id responseObject) {
        NSLog(@"4.2.35.1 获取客源进度客户信息 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] == 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            NSDictionary *dataDict = responseObject[@"data"];
            SISSBuyerInfoModel *buyerInfo = [SISSBuyerInfoModel yy_modelWithJSON:dataDict];
            
            if (successBlock) {
                successBlock(buyerInfo);
            }
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.30.1 设置交易房源 GET请求
- (void)confirmTradeHouseWithParameters:(NSDictionary *)parameters success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_BUYER_CONFIRM_TRADE_HOUSE parameters:parameters success:^(id responseObject) {
        NSLog(@"4.30.1 设置交易房源 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        if (successBlock) {
            successBlock(responseObject);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.30.2 获取交易房源 GET请求
- (void)requestTradeHouseInfoWithAdbpId:(NSString *)adbpId success:(void (^)(SISSHouseResourceModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"adbpId":adbpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_TRADE_HOUSE parameters:parameters success:^(id responseObject) {
        NSLog(@"4.30.2 获取交易房源 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSDictionary *dataDict = responseObject[@"data"];
        SISSHouseResourceModel *houseInfo = [SISSHouseResourceModel yy_modelWithJSON:dataDict];
        
        if (successBlock) {
            successBlock(houseInfo);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}



@end
